package com.kingsoft.demo.proxy.dynamic;

import java.lang.reflect.Proxy;

/**
 * 动态代理 
 * @author kbl
 *
 */
public class ProxyClient {

	public static void main(String[] args) {
		
		// 元对象(被代理对象)
		ManagerImpl managerImpl = new ManagerImpl();

		  //业务代理类
		BusinessHandler securityHandler = new BusinessHandler(managerImpl);

		//获得代理类的实例
		Manager proxy = (Manager)Proxy.newProxyInstance(managerImpl.getClass().getClassLoader(), managerImpl.getClass().getInterfaces(), securityHandler);
		
		proxy.test();
	}
}
